home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 8
/
The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO
/
g_quake
/
server~1.zip
/
_WELDGUN.QC
< prev
next >
Wrap
Text File
|
1996-10-04
|
6KB
|
200 lines
/*
**
** _weldgun.qc (WeldGun Code, 1.0)
**
** Copyright (C) 1996 Johannes Plass
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
** Author: Johannes Plass (plass@dipmza.physik.uni-mainz.de)
**
*/
void(entity player) WeldInfo =
{
if (!USE_MODULE_WELDGUN) return;
// 123456789#123456789#123456789#12345678
sprint(player,"£");
sprint(player," WeldGun");
sprint(player, " lets the nailgun spit metal\n");
sprint(player," blobs. Use 'help-weldgun' for help.\n");
};
void(entity player) WeldInit =
{
if (!USE_MODULE_WELDGUN) return;
stuffcmd(player,"alias help-weldgun \"impulse 217\";\n");
};
void(entity player) WeldActiveMessage =
{
if (!USE_MODULE_WELDGUN) return;
// 123456789#123456789#123456789#12345678
sprint(player," WeldGun (help-weldgun)\n");
};
void(entity player) WeldHelp =
{
if (!USE_MODULE_WELDGUN) return;
// 123456789#123456789#123456789#12345678
sprint(player,"WeldGun:");
sprint(player, " spits burning blobs of a\n");
sprint(player,"magnesium-steel mixture in rapid\n");
sprint(player,"succession.\n");
sprint(player,"To use it select the nailgun. Select\n");
sprint(player,"it again to shoot spikes instead.\n");
sprint(player,"The silver key is lit if the weldgun\n");
sprint(player,"is active.\n");
sprint(player,"Players hit by burning blobs may\n");
sprint(player,"start to burn.\n");
};
//========================================================================
// WeldToggleWeapon
//========================================================================
void(entity player) WeldToggleWeapon =
{
if (!USE_MODULE_WELDGUN) return;
if (player.modules_weapon & MODULES_WEAPON_WELD) {
player.modules_weapon = player.modules_weapon - MODULES_WEAPON_WELD;
player.items = player.items - (player.items & IT_KEY1);
} else {
if ((player.weapon == IT_NAILGUN) && (player.ammo_nails >= 1)) {
player.modules_weapon = player.modules_weapon | MODULES_WEAPON_WELD;
player.items = player.items | IT_KEY1;
}
}
};
//========================================================================
// WeldResetWeapon
//========================================================================
void(entity player) WeldResetWeapon =
{
if (!USE_MODULE_WELDGUN) return;
if (player.modules_weapon & MODULES_WEAPON_WELD) {
player.modules_weapon = player.modules_weapon - MODULES_WEAPON_WELD;
player.items = player.items - (player.items & IT_KEY1);
}
};
//==================================================================
// WeldFire
//==================================================================
void(vector org, vector dir) WeldFire =
{
local entity weld;
weld = spawn();
weld.owner = self;
weld.movetype = MOVETYPE_FLYMISSILE;
weld.solid = SOLID_BBOX;
weld.touch = WeldTouch;
weld.classname = "weld_blob";
weld.think = SUB_Remove;
weld.nextthink = time + 6;
weld.velocity = dir * 1000;
weld.angles = vectoangles(weld.velocity);
weld.angles_x = weld.angles_x + 90;
weld.modules_weapon = MODULES_WEAPON_WELD;
if (time >= weld.owner.weld_light_time) {
weld.effects = weld.effects | EF_DIMLIGHT;
weld.owner.weld_light_time = time + 0.2;
}
setmodel (weld, "progs/flame2.mdl");
setsize (weld, VEC_ORIGIN, VEC_ORIGIN);
setorigin (weld, org - '0 0 6' + dir*8);
sound (weld.owner, CHAN_WEAPON, weld_fire_sound_1, 0.6, ATTN_NORM);
sound (weld, CHAN_BODY, weld_fire_sound_2, 1, ATTN_NORM);
};
//==================================================================
// WeldTouch
//==================================================================
void() WeldExplode1 = [0, WeldExplode2] {};
void() WeldExplode2 = [3, WeldExplode3] {};
void() WeldExplode3 = [4, SUB_Remove] {};
float WELD_DAMAGE_RADIUS = 70;
void() WeldTouch =
{
local float r,d,db;
local entity e;
if (pointcontents(self.origin) == CONTENT_SKY) {
remove(self);
return;
}
if (other.takedamage) { spawn_touchblood (9); }
e = findradius(self.origin, WELD_DAMAGE_RADIUS);
while (e) {
if (e.takedamage) {
if (e.takedamage != DAMAGE_AIM) {
T_Damage (e, self, self.owner, 10);
} else {
r = random();
db = 10 + (0.5 - r)*6;
d = vlen(e.origin + '0 0 16' - self.origin);
if (d<WELD_DAMAGE_RADIUS - 4*db) d = db;
else if (d<WELD_DAMAGE_RADIUS) d = (WELD_DAMAGE_RADIUS-d)*0.25;
else d = 0;
if (d) {
T_Damage (e, self, self.owner, d);
if (r > 0.85) { //#jp#(Burn)
if (d > 5) { //#jp#(Burn)
BurnSetOnFire(e,self.owner); //#jp#(Burn)
} //#jp#(Burn)
} //#jp#(Burn)
}
}
}
e = e.chain;
}
self.origin = self.origin - 4 * normalize(self.velocity);
self.movetype = MOVETYPE_NONE;
self.velocity = '0 0 0';
self.touch = SUB_Null;
self.solid = SOLID_NOT;
self.think = SUB_Remove; // be on the
self.nextthink = time + 4; // safe side
setmodel(self, "progs/s_explod.spr");
setorigin(self, self.origin);
sound (self, CHAN_BODY, weld_explode_sound, 1, ATTN_NORM);
WeldExplode1();
};